package com.gitee.wsl.text.dfa


/**
 * @author 肖海斌
 * 敏感词过滤处理器，默认按字符数替换成*
 */
interface SensitiveProcessor {
    /**
     * 敏感词过滤处理
     * @param foundWord 敏感词匹配到的内容
     * @return 敏感词过滤后的内容，默认按字符数替换成*
     */
    fun process(foundWord: FoundWord): String {
        val length: Int = foundWord.foundWord.length
        val sb = StringBuilder(length)
        for (i in 0..<length) {
            sb.append("*")
        }
        return sb.toString()
    }
}
